package com.ruoyi.web.controller.gasoline;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.domain.ChildGasoline;
import com.ruoyi.service.IChildGasolineService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * 【请填写功能名称】Controller
 * 
 * @author ruoyi
 * @date 2020-06-23
 */
@Controller
@RequestMapping("/ruoyi/childcard")
public class ChildCardController extends BaseController
{
    private String prefix = "ruoyi/Maingasoline";

    @Autowired
    private IChildGasolineService childGasolineService;

    @RequiresPermissions("ruoyi:childcard:view")
    @GetMapping("/childcard")
    public String gasoline()
    {
        return prefix + "/childcard";
    }

    /**
     * 查询【请填写功能名称】列表
     */
    @RequiresPermissions("ruoyi:childcard:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(ChildGasoline childGasoline)
    {
        startPage();
        List<ChildGasoline> list = childGasolineService.selectChildGasolineLists(childGasoline);
        return getDataTable(list);
    }

    /**
     * 导出【请填写功能名称】列表
     */
    @RequiresPermissions("ruoyi:childcard:export")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(ChildGasoline childGasoline)
    {
        List<ChildGasoline> list = childGasolineService.selectChildGasolineList(childGasoline);
        ExcelUtil<ChildGasoline> util = new ExcelUtil<ChildGasoline>(ChildGasoline.class);
        return util.exportExcel(list, "Childgasoline");
    }

}
